package de.fmannan.wildit.ui;

import de.fmannan.wildit.persistence.PersistenceAdapter;
import de.fmannan.wildit.persistence.PersistenceProvider;
import android.app.TabActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TabHost;

/**
 * Manages tabs which structure the application's layout. Essentially there are three tabs:
 * Home, Day and Night. Day and Night contain options and activities related to the day, respectively
 * night time. The Home Tab allows for general settings/features.
 * 
 * @author fmannan
 *
 */
public class TabManager extends TabActivity{
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
				
		try
		{
			TabHost tabCollection = getTabHost();
			//Spawn and add home tab
			tabCollection.addTab(tabCollection.newTabSpec("HomeScreen")
					.setIndicator(getString(R.string.home))
					.setContent(new Intent(this, HomeScreen.class)));
			//Spawn and add day tab
			tabCollection.addTab(tabCollection.newTabSpec("DayScreen")
					.setIndicator(getString(R.string.day))
					.setContent(new Intent(this, DayScreen.class)));		
			//Spawn and add night tab
			tabCollection.addTab(tabCollection.newTabSpec("NightScreen")
					.setIndicator(getString(R.string.night))
					.setContent(new Intent(this, NightScreen.class)));			
		} 
		catch(Exception exc)
		{
			Log.e(getClass().toString(), "Failed to create application tabs: " + exc.getMessage());
		}
		
		
	}
}
